//
//  TokenInfo.h
//  LightBasic
//
//  Created by Albert on 23/03/2011.
//  Copyright 2011 LightBasic Development Team. All rights reserved.
//
#pragma once
#include "TokenType.h"

namespace lbc {
    
    /// string reference
    class StringRef;
    
    /**
     * Collection of static methods to query token type and info
     */
    namespace TokenInfo
    {
        
        /// Find token class by string
        TokenType GetTokenType(const std::string & ident, TokenType def);
        
        /// Get token name
        const StringRef & GetTokenName(TokenType type);
        
        /// Get operator precedence
        int GetOperatorPrecedence(TokenType type);
        
        /// os operator?
        bool IsOperator(TokenType type);
        
        /// Is binary operator?
        bool IsBinaryOperator(TokenType type);
        
        /// Is unary operator?
        bool IsUnaryOperator(TokenType type);
        
        /// Is right to left associative?
        bool IsRtlOperator(TokenType type);
        
        /// Is keyword token?
        bool IsKeyword(TokenType type);
        
        /// Is generic token?
        bool IsToken(TokenType type);
        
    };
    
}